/****************************************************************************

	COPYRIGHT(C) MAXSI SOFTWARE, JONAS 'SORTIE' TERMANSEN 2008, 2009

    This file is part of Maxsi Distribution.

    Maxsi Distribution is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Maxsi Distribution is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with Maxsi Distribution. If not, see <http://www.gnu.org/licenses/>.

	*/ #include "MaxsiDistributionContributors.h" /*

	If you modify this file, please enter your name below and provide contact
	information in MaxsiDistributionContributors.h. For more information please see
	MaxsiDistributionContributors.h.
	
	Contributors to this file:

	- Jonas 'Sortie' Termansen
	- [your name here]

	MaxsiDistribution.dll
	Distributing since 2008

	MaxsiUpdate.cpp
	Functions that ensure this product is up to date.

****************************************************************************/

#ifndef MaxsiUpdate_H
#define MaxsiUpdate_H

	#undef LINK
	#undef CLASSLINK
	#undef LINKCPP
	#undef CLASSLINKCPP

	#define LINK DllExport
	#define CLASSLINK extern "C" class __declspec( dllexport )
	#define LINKCPP DllExportCPP
	#define CLASSLINKCPP extern "C++" class __declspec( dllexport )

	#define	RESULT_DONT_RUN						0
	#define	RESULT_RUN							1
	#define	RESULT_UPDATE_UPDATING_SOFTWARE		2
	#define	RESULT_UPDATE_UPDATED_SOFTWARET		3
	#define	RESULT_UPDATE_UPDATING_FAILED		4
	#define	RESULT_INVALID_PARAMETER_SIZE		5

	struct UpdateProductArguments 
	{
		size_t Size; // = sizeof(UpdateProductArguments);
		char* FolderName;
		char* WorkingDir;
		char* Username;
		char* Product;
		char* ProductVersion;
		char* DownloadName;
		char* DownloadVersion;
		char* GameFolder;
	};

	DECLARE_FUNCTION_HEADER(bool,PingBackEngine,(char*));


	// Returns true if the product can be run, false if an update-process has begun.
	LINK	int		UpdateProduct				(UpdateProductArguments Arg);
	LINK	int		ReportCrashes				(UpdateProductArguments Arg);
	LINK	bool	PingBack					(char* Function, char* Parameter, char* Username, char* Product, char* Version, type_PingBackEngine PingBackFunc = 0);
			bool	InitializeMaxsiDistribution	(char* FolderName);
			bool	ReportError					(const char* Error, bool DontShowNotepad = false);	
			bool	TerminateMaxsiDistribution	(void);
			bool	UpdateAvailable				(void);
			bool	InstallUpdate				(void);

	MISFUNCH(Crash);

#endif